<!--
 * @Description: 
 * @Author: charles
 * @Date: 2021-05-05 22:02:56
 * @LastEditors: 晋龍
 * @LastEditTime: 2022-01-07 10:20:56
-->
<template>
  <!--1. 容器 -->
  <div ref="left1_container" id="container" style="height: 95%"></div>
</template>
<script>
import{ Line } from '@antv/g2plot'
export default {
  data(){
    return{
      dataArr:[
        {year:'1991',value:3},
        {year:'1992',value:4},
        {year:'1993',value:3.5},
        {year:'1994',value:5},
        {year:'1995',value:4.9},
        {year:'1996',value:6},
      ]
    }
  },
  mounted() {
    this.initChar();
  },
  methods:{

    initChar(){
      //3.创建一个折线图实例对象
      const line = new Line(this.Srefs.left1_container,{
        data:this.dataArr,//调用上面的dataArr
        xField: 'year',//x轴
        yField: 'value',//y轴
      });
      //4.渲染图像
      line.render();
    }
  },
}
</script>